package com.zaofan.utils;

import java.util.TimerTask;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class TaskSendContextListner implements ServletContextListener {
	private static java.util.Timer timer = null;

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		if (timer != null)
			timer.cancel();
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		timer = new java.util.Timer(true);
		timer.schedule(new TimerTask() {
			@Override
			public void run() {
				System.err.println("执行任务");
				System.err.println("任务结束");
			}
		}, 0, 5 * 60 * 1000);
	}

}
